import { Inject, Provide } from '@midwayjs/decorator';
import { IMidwayWebContext } from '@midwayjs/web';

@Provide()
export default abstract class BaseController {
  @Inject() ctx: IMidwayWebContext;

  success(data = {}) {
    const { ctx } = this;
    ctx.body = { status: 0, data };
  }
  fail(message = 'system error', status = -1) {
    const { ctx } = this;
    ctx.body = { status, message };
  }
}
